@use 'sass:map';

@use './shared' as *;
@use './design' as *;

$confirm: () !default;
$confirm: map.merge(
  (
    title-font-size: get-css-var('font-size-primary'),
    title-weight: 500,
    title-color: get-css-var('content-color-primary'),
    icon-color: get-css-var('color-warning-base'),
    close-color: get-css-var('content-color-placeholder'),
    close-color-hover: get-css-var('content-color-base'),
    header-padding: 8px,
    body-padding: 14px 8px,
    body-padding-with-title: 8px,
    actions-padding: 14px 8px 8px,
    header-v-padding: 10px,
    header-h-padding: 14px,
    body-v-padding: 10px,
    body-h-padding: 14px,
    footer-v-padding: 12px,
    footer-h-padding: 14px
  ),
  $confirm
);

.#{$namespace}-confirm {
  &-vars {
    @include define-preset-values('confirm', $confirm);
  }

  @include basis;

  .#{$namespace}-modal__content {
    position: relative;
    padding: 0;
  }

  &__header {
    position: relative;
    display: flex;
    align-items: center;
    padding: get-css-var('confirm-header-v-padding') get-css-var('confirm-header-h-padding');
  }

  &__title {
    flex: 1 0 0;
    font-size: get-css-var('modal-title-font-size');
    font-weight: get-css-var('modal-title-weight');
    color: get-css-var('modal-title-color');
  }

  &__body {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: get-css-var('confirm-body-v-padding') get-css-var('confirm-body-h-padding');

    // &--with-title {
    //   padding: get-css-var('confirm-body-padding-with-title');
    // }

    &--no-title {
      padding-top: calc(
        #{get-css-var('confirm-header-v-padding')} * 0.5 + #{get-css-var('confirm-body-v-padding')}
      );
    }

    &--left {
      justify-content: flex-start;
    }

    &--right {
      justify-content: flex-end;
    }
  }

  &__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-inline-end: 4px;
    color: get-css-var('confirm-icon-color');
  }

  &__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: get-css-var('confirm-footer-v-padding') get-css-var('confirm-footer-h-padding');

    &--left {
      justify-content: flex-start;
    }

    &--right {
      justify-content: flex-end;
    }
  }

  &__button {
    padding: 0 28px;

    &:last-child {
      margin-inline-start: 14px;
    }
  }

  &__close {
    position: relative;
    display: flex;
    align-items: center;
    height: 24px;
    padding: 0;
    margin-inline-start: 6px;
    color: get-css-var('confirm-close-color');
    cursor: pointer;
    background-color: transparent;
    border: 0;
    outline: 0;
    transition: get-css-var('transition-color');

    &:hover,
    &:focus {
      color: get-css-var('confirm-close-color-hover');
    }
  }
}
